import 'package:flutter/material.dart';
import 'package:flutter_design/route/navigate.dart';

class HomePage extends StatefulWidget {
  const HomePage({super.key});

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Home Demo'),
      ),
      body: Center(
        child: SingleChildScrollView(
          child: Container(
            padding: const EdgeInsets.all(16.0),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.start,
              crossAxisAlignment: CrossAxisAlignment.stretch,
              children: <Widget>[
                _buildItem("calendar"),
                _buildItem("pop"),
                _buildItem("refresher"),
                _buildItem("login"),
                _buildItem("search"),
                _buildItem("setting"),
              ],
            ),
          ),
        ),
      ),
    );
  }


  Widget _buildItem(String title){
    return Column(
      children: [
        ElevatedButton(
          onPressed:() {
            Navigate.push(context, "/$title");
          },
          child: Text('$title 页面'),
        ),
        const SizedBox(height: 12),
        const Divider(),
      ],
    );
  }
}
